﻿<%@ Control Language="C#" AutoEventWireup="true" Inherits="ProjectHT.YKDGVB2012.Core.UserControls.uc_CreateNew,ProjectHT.YKDGVB2012.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=69db40eb91817252" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI, Version=2012.2.607.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" %>
<%--
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>--%>
<asp:ScriptManager ID="scriptmanager1" runat="server">
</asp:ScriptManager>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

    <script type="text/javascript">
		/* <![CDATA[ */
		function GetRadWindow() {
			var oWindow = null;
			if (window.radWindow)
				oWindow = window.radWindow;
			else if (window.frameElement.radWindow)
				oWindow = window.frameElement.radWindow;
			return oWindow;
		}
		var cancelDropDownClosing = false;

		function pageLoad() {


			window.$telerik.$('#RadComboBox1_DropDown .rcbList li').click(function (e) {
				e.cancelBubble = true;
				if (e.stopPropagation) {
					e.stopPropagation();
				}
			});
		}

		function CloseWindow() {

			var win = GetRadWindow();
			win.close();

		}

		function StopPropagation(e) {
			//cancel bubbling
			e.cancelBubble = true;
			if (e.stopPropagation) {
				e.stopPropagation();
			}
		}

		function onBlur(sender) {
			//cancelDropDownClosing = false;
			window.cancelFirstCombo = false;
		}

		function onDropDownClosing(sender, args) {
			cancelDropDownClosing = false;
		}

		

		
		//this method removes the ending comma from a string
		function removeLastComma(str) {
			return str.replace(/,$/, "");
		}

		

		function OnClientDropDownClosingHandler(sender, e) {
			//do not close the second combo if 
			//a checkbox from the first is clicked

			e.set_cancel(cancelDropDownClosing);
		}

		function OnResponseEnd(sender, args) {

			Message.alert("Dữ liệu đã được cập nhật", function () { CloseWindow(); }, "");
		}

		function oncliend(sender, agrs) {

			if (!window.Page_IsValid) {

				$.each(window.Page_Validators, function (i, n) {

					var controle = n.controltovalidate;
					$("#" + controle).attr("style", "border: 1px red solid;");

				});
			}
		}
		function onclientClick(sender,args)
		{
		    CloseWindow();
		
		}
		function conditionalPostback(sender, args) {
			var currentUpdatedControl = "<%=RadAjaxPanel1.ClientID%>";
			if (args.get_eventTarget() == "<%= _raddvSave.UniqueID %>") {
				var divElementStyle = window.$find("<%=RadAjaxLoadingPanel1.ClientID %>");
				divElementStyle.show(currentUpdatedControl);
				args.set_enableAjax(false);
			}
		}
		/* ]]> */
    </script>

    <script type="text/javascript">
	$(document).ready(function(){
	var hident= $("#<%=fileAttch.ClientID%>");
	var filename = $("#<%=filename.ClientID%>");
	if (hident.val()!="")
	{
	  var file = "<a href='"+hident.val()+"'>"+filename.val()+" </a> <span id='del'> Xóa</span>"
	  $(".display").append(file);	 
	  $("#filecontrole").hide();
	}
	
	$("#del").click(function(){
	
	   $(".display").empty();
	   $("#filecontrole").show();	
	});
	});
	
    </script>

</telerik:RadCodeBlock>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" ClientEvents-OnRequestStart="conditionalPostback"
    runat="server" Height="100%" Width="100%" HorizontalAlign="NotSet" LoadingPanelID="RadAjaxLoadingPanel1">
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default" />
    <asp:HiddenField ID="fileAttch" runat="server" />
    <asp:HiddenField ID="filename" runat="server" />
    <div id="f_dialog">
        <ul>
            <li class="f_dialog_rows">
                <div class="f-dialog_labler">
                    Tiêu đề dự thảo luật<span class="req">*</span>
                </div>
                <div class="f-dialog_fields">
                    <telerik:RadTextBox runat="server" ID="Radtitle" Width="350px" />                    
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="Radtitle"
                        ErrorMessage="Trường này yêu cầu phải nhập" Display="Dynamic" />
                </div>
            </li>
            <li class="f_dialog_rows">
                <div class="f-dialog_labler">
                    Mô tả dự thảo luật
                </div>
                <div class="f-dialog_fields">
                    <telerik:RadTextBox runat="server" TextMode="MultiLine" Height="120px" Width="350px"
                        ID="txtdescription">
                    </telerik:RadTextBox>
                </div>
            </li>
            <li class="f_dialog_rows">
                <div class="f-dialog_labler">
                    Mô tả dự thảo luật
                </div>
                <div class="f-dialog_fields">
                    <%--   <telerik:RadTextBox runat="server" TextMode="MultiLine" Height="120px" Width="350px"
                        ID="txtdescription">
                    </telerik:RadTextBox>--%>
                    <telerik:RadEditor ID="txtContent" runat="server" EditModes="Design, Preview" EnableResize="False"
                        Height="250px" ToolbarMode="Default" ToolsFile="/_Layouts/1033/images/EditorXML/toolbar-basic.xml"
                        Width="440px">
                    </telerik:RadEditor>
                </div>
            </li>
            <li class="f_dialog_rows">
                <div class="f-dialog_labler">
                    File đính kèm:
                </div>
                <div class="f-dialog_fields">
                    <div class="display">
                    </div>
                    <div id="filecontrole">
                        <telerik:RadUpload runat="server" ID="uploadfile" Culture="vi-VN" InputSize="35"
                            OverwriteExistingFiles="True" Style="margin-left: -17px;" AllowedFileExtensions="*.doc,*.docx"
                            InitialFileInputsCount="1" MaxFileInputsCount="0" MaxFileSize="2048000" ControlObjectsVisibility="None"
                            Width="343px">
                        </telerik:RadUpload>
                    </div>
                </div>
            </li>
            <li class="f_dialog_rows">
                <div class="f-dialog_labler">
                    Lấy ý kiến đến ngày: <span class="req">*</span>
                </div>
                <div class="f-dialog_fields">
                    <telerik:RadDatePicker runat="server" ID="txtthoigianthuchien" Enabled="True" Culture="vi-VN"
                        MinDate="1900-01-01">
                        <Calendar UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False" ViewSelectorText="x">
                        </Calendar>
                        <DateInput DateFormat="dd/MM/yyyy" DisplayDateFormat="dd/MM/yyyy" DisplayText=""
                            LabelWidth="40%">
                        </DateInput>
                        <DatePopupButton HoverImageUrl="" ImageUrl="" />
                    </telerik:RadDatePicker>
                </div>
            </li>
            <li class="f_dialog_rows">
                <div class="f-dialog_labler">
                    Trạng thái
                </div>
                <div class="f-dialog_fields">
                    <asp:CheckBox ID="btnStatus" runat="server" />
                    Công bố
                </div>
            </li>
            <li class="f_dialog_rows">
                <div class="f-dialog_labler">
                    Hết hạn
                </div>
                <div class="f-dialog_fields">
                    <asp:CheckBox ID="checkhethan" runat="server" />
                    Hết hạn
                </div>
            </li>
            <li class="f_dialog_rows f-submitarea">
                <div class="f_buttons">
                    <telerik:RadButton ID="_raddvSave" Width="80px" ButtonType="StandardButton" runat="server"
                        Text="Lưu lại" />
                    <telerik:RadButton ID="btnCancel" Width="80px" ButtonType="StandardButton" runat="server"
                        Text="Đóng lại" OnClientClicked="onclientClick" />
                </div>
            </li>
        </ul>
    </div>
</telerik:RadAjaxPanel>